package com.zjgsu.nftplatform.pojo;

import com.zjgsu.nftplatform.entity.Nft;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel("nft 视图")
public class NftView {

    @ApiModelProperty("主键")
    private String id;
    @ApiModelProperty("封面图片地址")
    private String img;
    @ApiModelProperty("名称")
    private String name;
    @ApiModelProperty("描述/简介")
    private String description;
    @ApiModelProperty("细分类别")
    private String kind;
    @ApiModelProperty("属性：rap、流行")
    private String attribute;
    @ApiModelProperty("文件hash")
    private String fileHash;
    @ApiModelProperty("上传者/创作者id")
    private String userId;
    @ApiModelProperty("用户名")
    private String username;
    @ApiModelProperty("所有权状态  1 待确认  2 未上架  3 一口价  4 商品拍卖  5售罄  6 违法")
    private Integer status;
    @ApiModelProperty("链上地址")
    private String chainAddress;
    @ApiModelProperty("所有者id")
    private String ownerId;
    @ApiModelProperty("所有者用户名")
    private String ownerName;
    @ApiModelProperty("浏览量")
    private Integer views;

    public NftView(Nft nft) {
        this.id = nft.getId().toString();
        this.img = nft.getImg();
        this.name = nft.getName();
        this.description = nft.getDescription();
        this.kind = nft.getKind();
        this.attribute = nft.getAttribute();
        this.fileHash = nft.getFileHash();
        this.userId = nft.getUserId().toString();
        this.username = nft.getUsername();
        this.status = nft.getStatus();
        this.chainAddress = nft.getChainAddress();
        this.ownerId = nft.getOwnerId().toString();
        this.ownerName = nft.getOwnerName();
        this.views = nft.getViews();
    }
}
